This is going to be necessary for the builder.
At the end, the Yocto build process generates two tarballs: one for a
base "runtime", and one "devel" with all of the development tools like
gcc. We then import that into an OSTree branch
-e.g. "bases/gnomeos-3.4-yocto-i686-devel".
+e.g. "bases/yocto/gnomeos-3.4-i686-devel".
We also have a Yocto recipe "ostree-native" which generates (as you
might guess) a native binary of ostree. That binary is used to import
import tempfile
import StringIO
+from . import ostbuildrc
from .subprocess_helpers import run_sync_get_output
BUILD_ENV = {
revision = run_sync_get_output(child_args, log_initiation=True).strip()
os.unlink(path)
return revision
+
+def get_base_user_chroot_args():
+ path = find_user_chroot_path()
+ args = [path, '--unshare-pid', '--unshare-ipc']
+ if not ostbuildrc.get_key('preserve_net', default=False):
+ args.append('--unshare-net')
+ return args
+
+
parser = argparse.ArgumentParser(description=self.short_description)
parser.add_argument('--skip-built', action='store_true')
parser.add_argument('--recompose', action='store_true')
+ parser.add_argument('--skip-compose', action='store_true')
parser.add_argument('--start-at')
parser.add_argument('--shell-on-failure', action='store_true')
parser.add_argument('--debug-shell', action='store_true')
component = self.snapshot['components'].get(component_name)
self._build_one_component(component_name, component)
- for target in self.snapshot['targets']:
- self._compose(target)
+ if not args.skip_compose:
+ for target in self.snapshot['targets']:
+ self._compose(target)
builtins.register(OstbuildBuild)
from . import builtins
from . import buildutil
from . import fileutil
+from . import ostbuildrc
from .ostbuildlog import log, fatal
from .subprocess_helpers import run_sync, run_sync_get_output
chroot_sourcedir = os.path.join('/ostbuild', 'source', component_name)
- ostbuild_user_chroot_path = buildutil.find_user_chroot_path()
-
- child_args = [ostbuild_user_chroot_path, '--unshare-pid', '--unshare-net', '--unshare-ipc',
- '--mount-readonly', '/',
- '--mount-proc', '/proc',
- '--mount-bind', '/dev', '/dev',
- '--mount-bind', child_tmpdir, '/tmp',
- '--mount-bind', os.getcwd(), chroot_sourcedir,
- '--mount-bind', resultdir, '/ostbuild/results',
- '--chdir', chroot_sourcedir]
+ child_args = buildutil.get_base_user_chroot_args()
+ child_args.extend([
+ '--mount-readonly', '/',
+ '--mount-proc', '/proc',
+ '--mount-bind', '/dev', '/dev',
+ '--mount-bind', child_tmpdir, '/tmp',
+ '--mount-bind', os.getcwd(), chroot_sourcedir,
+ '--mount-bind', resultdir, '/ostbuild/results',
+ '--chdir', chroot_sourcedir])
if args.debug_shell:
child_args.extend([rootdir, '/bin/sh'])
else:
args = parser.parse_args(argv)
- ostbuild_user_chroot_path = buildutil.find_user_chroot_path()
-
- child_args = [ostbuild_user_chroot_path,
- '--unshare-pid', '--unshare-net', '--unshare-ipc',
- '--mount-proc', '/proc',
- '--mount-bind', '/dev', '/dev',
- args.root,
- '/usr/bin/ostree-run-triggers']
- print "%r" % (child_args,)
+ child_args = buildutil.get_base_user_chroot_args()
+ child_args.extend(['--mount-proc', '/proc',
+ '--mount-bind', '/dev', '/dev',
+ args.root,
+ '/usr/bin/ostree-run-triggers'])
env_copy = dict(buildutil.BUILD_ENV)
env_copy['PWD'] = '/'
run_sync(child_args, env=env_copy)
_config[k.strip()] = v.strip()
return _config
-def get_key(name, provided_args=None):
+# This hack is because we want people to be able to pass None
+# for "default", but still distinguish default=None from default
+# not passed.
+_default_not_supplied = object()
+def get_key(name, provided_args=None, default=_default_not_supplied):
+ global _default_not_supplied
config = get()
if provided_args:
v = provided_args.get(name)
if v is not None:
return v
- return config[name]
+ if default is _default_not_supplied:
+ # Possibly throw a KeyError
+ return config[name]
+ value = config.get(name, _default_not_supplied)
+ if value is _default_not_supplied:
+ return default
+ return value